import { ref } from "vue";
import { type Firm, type Device } from "./model";
import { deviceEdit, query } from "./http";

export const selectDevice = ref<Device|null>(null);
export const allDevices = ref<Device[]>([]);


export async function updateDevice() {
    allDevices.value = await query();
}

export async function editAndUpdate(device: Device) {
    await deviceEdit(device)
    await updateDevice();
}

